package contracheque.calculo;

public class Irpf extends Imposto {
    
    private double deducao[];
    
    public Irpf() {
        this.deducao = new double[5];
        this.deducao[0] = 0;
        this.deducao[1] = 128.31;
        this.deducao[2] = 320.60;
        this.deducao[3] = 577.00;
        this.deducao[4] = 790.58;
        
        this.minimo = new double[5];
        this.minimo[0] = 0;
        this.minimo[1] = 1710.79;
        this.minimo[2] = 2563.92;
        this.minimo[3] = 3418.60;
        this.minimo[4] = 4271.59;
        
        this.maximo = new double[5];
        this.maximo[0] = 1710.78;
        this.maximo[1] = 2563.91;
        this.maximo[2] = 3418.59;
        this.maximo[3] = 4271.59;
        this.maximo[4] = 9999999;
        
        this.percentual = new double[5];
        this.percentual[0] = 0;        
        this.percentual[1] = 7.5;
        this.percentual[2] = 15;
        this.percentual[3] = 22.5;
        this.percentual[4] = 27.5;
    }
    
    @Override
    public double calcularValor(double salario) {
        int faixa = this.getNrFaixa(salario);
        double valor = super.calcularValor(salario);
        valor -= this.deducao[faixa-1];
        return valor;
    }
}
